<table>
	<tr>
		<td>Titre :</td>
		<td><?= form_input('title', $post->title) ?></td>
	</tr>
	<tr>
		<td>En ligne :</td>
		<td><?= form_checkbox('online', 1, $post->online) ?></td>
	</tr>
	<tr>
		<td>Tags :</td>
		<td>
			<span id="post-tags-container">
			<?php foreach ($tags as $tag)
				echo '
				<span class="post-tag">
					'.$tag->name.'
					<a href="#" class="post-tag-remove">'.icon_tag('tag_blue_delete').'</a>
				</span>';
			?>
			</span>
			<input type="text" id="post-tag-value" />
			<a href="#" id="post-tag-add"><?= icon_tag('tag_blue_add') ?></a>
			<?php
			// the actual tag names field
			$tag_string = '';
			foreach ($tags as $tag) {
				$tag_string .= $tag->name . ';';
			}
			echo form_hidden('tag_names', $tag_string);
			?>
		</td>
	</tr>
</table>
<p><?= form_textarea('body', $post->body) ?></p>

<script type="text/javascript">
	// autocomplete tags
	var POST_TAGS_ALL = [
		<?php foreach ($all_tags as $tag) {
			echo '"'.$tag->name.'",';
		} ?>
	];
	$('input#post-tag-value').autocomplete({
		source: POST_TAGS_ALL
	});
</script>
